﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SuYuanRabbit.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class InitDB : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Accessories",
                columns: table => new
                {
                    AccessoriesId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    AccessoriesBatches = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Accessories", x => x.AccessoriesId);
                });

            migrationBuilder.CreateTable(
                name: "AccessoriesImages",
                columns: table => new
                {
                    AccessoriesImageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    AccessoriesImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AccessoriesImages", x => x.AccessoriesImageId);
                });

            migrationBuilder.CreateTable(
                name: "DynamicInspectionInformations",
                columns: table => new
                {
                    DynamicInspectionId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    DynamicInspectionPhoto = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_DynamicInspectionInformations", x => x.DynamicInspectionId);
                });

            migrationBuilder.CreateTable(
                name: "FarmingCompanyInformations",
                columns: table => new
                {
                    FCompanyId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    FCompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FCompanyLeader = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FCompanySavingNums = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FarmingCompanyInformations", x => x.FCompanyId);
                });

            migrationBuilder.CreateTable(
                name: "FarmingInformations",
                columns: table => new
                {
                    FarmingId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    FarmingBreed = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FarmingComeSource = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FarmingDays = table.Column<int>(type: "int", nullable: false),
                    FarmingFeedBrands = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FarmingPerson = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    FarmingOutTime = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FarmingInformations", x => x.FarmingId);
                });

            migrationBuilder.CreateTable(
                name: "FCompanyImages",
                columns: table => new
                {
                    FCImageId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FCImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FCompanyImages", x => x.FCImageId);
                });

            migrationBuilder.CreateTable(
                name: "FoodSafetyImages",
                columns: table => new
                {
                    FImageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    FImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FoodSafetyImages", x => x.FImageId);
                });

            migrationBuilder.CreateTable(
                name: "ImmunizationInformations",
                columns: table => new
                {
                    ImmunizationId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ImmunizationSavingDays = table.Column<int>(type: "int", nullable: false),
                    ImmunizationName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ImmunizationStyle = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ImmunizationInformations", x => x.ImmunizationId);
                });

            migrationBuilder.CreateTable(
                name: "PackagingMaterials",
                columns: table => new
                {
                    PackagingMaterialsId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    PackagingMaterialsBatches = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PackagingMaterials", x => x.PackagingMaterialsId);
                });

            migrationBuilder.CreateTable(
                name: "PackagingMaterialsImages",
                columns: table => new
                {
                    PMaterialsImageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    PMaterialsImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PackagingMaterialsImages", x => x.PMaterialsImageId);
                });

            migrationBuilder.CreateTable(
                name: "PCCCascades",
                columns: table => new
                {
                    CascadeId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CascadeParentId = table.Column<int>(type: "int", nullable: false),
                    CascadeCurrentName = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PCCCascades", x => x.CascadeId);
                });

            migrationBuilder.CreateTable(
                name: "Permissions",
                columns: table => new
                {
                    PermissionId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    PermissionName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    PermissionUrl = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ParentId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Permissions", x => x.PermissionId);
                });

            migrationBuilder.CreateTable(
                name: "ProcessingInformations",
                columns: table => new
                {
                    ProcessingId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ProcessingTeam = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProcessingLeader = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProcessingInformations", x => x.ProcessingId);
                });

            migrationBuilder.CreateTable(
                name: "QualificationInformations",
                columns: table => new
                {
                    QualificationId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    QualificationImage = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_QualificationInformations", x => x.QualificationId);
                });

            migrationBuilder.CreateTable(
                name: "RawMaterialImages",
                columns: table => new
                {
                    RMaterialImageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    RMaterialImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RawMaterialImages", x => x.RMaterialImageId);
                });

            migrationBuilder.CreateTable(
                name: "RawMaterials",
                columns: table => new
                {
                    RawMaterialId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    RawMaterialBatches = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RawMaterials", x => x.RawMaterialId);
                });

            migrationBuilder.CreateTable(
                name: "RolePermissions",
                columns: table => new
                {
                    RolePermissionId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    PermissionId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RolePermissions", x => x.RolePermissionId);
                });

            migrationBuilder.CreateTable(
                name: "Roles",
                columns: table => new
                {
                    RoleId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleName = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Roles", x => x.RoleId);
                });

            migrationBuilder.CreateTable(
                name: "RoleUsers",
                columns: table => new
                {
                    RoleUserId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RoleId = table.Column<int>(type: "int", nullable: false),
                    UserId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RoleUsers", x => x.RoleUserId);
                });

            migrationBuilder.CreateTable(
                name: "Shops",
                columns: table => new
                {
                    ShopId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    ShopName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ShopProductionBatches = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ShopLefeTime = table.Column<int>(type: "int", nullable: false),
                    ShopProductionLisenceNum = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ShopProductionCompany = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ShopPhoto = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    AddPerson = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    AddTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    UpdatePerson = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Shops", x => x.ShopId);
                });

            migrationBuilder.CreateTable(
                name: "SlaughterCompanyImages",
                columns: table => new
                {
                    SCImageId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SCImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SlaughterCompanyImages", x => x.SCImageId);
                });

            migrationBuilder.CreateTable(
                name: "SlaughterCompanyInformations",
                columns: table => new
                {
                    SCompanyId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    SCompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SCompanyProvince = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SCompanyCity = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SCompanyCounty = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SCompanyCreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    SCourierCompanyDescription = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SlaughterCompanyInformations", x => x.SCompanyId);
                });

            migrationBuilder.CreateTable(
                name: "SlaughterInformations",
                columns: table => new
                {
                    SlaughterId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    SlaugtherBatches = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    SlaughterWeight = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    SlaughterInTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    SlaughterDate = table.Column<DateTime>(type: "datetime2", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SlaughterInformations", x => x.SlaughterId);
                });

            migrationBuilder.CreateTable(
                name: "Users",
                columns: table => new
                {
                    UserId = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    UserAccount = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    UserPassword = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    UserNickName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    UserPhone = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    UserEmail = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ErrorNums = table.Column<int>(type: "int", nullable: false),
                    IsLocked = table.Column<bool>(type: "bit", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Users", x => x.UserId);
                });

            migrationBuilder.CreateTable(
                name: "VendorCompanies",
                columns: table => new
                {
                    VCompanyId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    VCompanyTeam = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    VCompanyLeader = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VendorCompanies", x => x.VCompanyId);
                });

            migrationBuilder.CreateTable(
                name: "VendorCompanyImages",
                columns: table => new
                {
                    VCompanyImageId = table.Column<string>(type: "nvarchar(450)", nullable: false),
                    VCompanyImageUrl = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VendorCompanyImages", x => x.VCompanyImageId);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Accessories");

            migrationBuilder.DropTable(
                name: "AccessoriesImages");

            migrationBuilder.DropTable(
                name: "DynamicInspectionInformations");

            migrationBuilder.DropTable(
                name: "FarmingCompanyInformations");

            migrationBuilder.DropTable(
                name: "FarmingInformations");

            migrationBuilder.DropTable(
                name: "FCompanyImages");

            migrationBuilder.DropTable(
                name: "FoodSafetyImages");

            migrationBuilder.DropTable(
                name: "ImmunizationInformations");

            migrationBuilder.DropTable(
                name: "PackagingMaterials");

            migrationBuilder.DropTable(
                name: "PackagingMaterialsImages");

            migrationBuilder.DropTable(
                name: "PCCCascades");

            migrationBuilder.DropTable(
                name: "Permissions");

            migrationBuilder.DropTable(
                name: "ProcessingInformations");

            migrationBuilder.DropTable(
                name: "QualificationInformations");

            migrationBuilder.DropTable(
                name: "RawMaterialImages");

            migrationBuilder.DropTable(
                name: "RawMaterials");

            migrationBuilder.DropTable(
                name: "RolePermissions");

            migrationBuilder.DropTable(
                name: "Roles");

            migrationBuilder.DropTable(
                name: "RoleUsers");

            migrationBuilder.DropTable(
                name: "Shops");

            migrationBuilder.DropTable(
                name: "SlaughterCompanyImages");

            migrationBuilder.DropTable(
                name: "SlaughterCompanyInformations");

            migrationBuilder.DropTable(
                name: "SlaughterInformations");

            migrationBuilder.DropTable(
                name: "Users");

            migrationBuilder.DropTable(
                name: "VendorCompanies");

            migrationBuilder.DropTable(
                name: "VendorCompanyImages");
        }
    }
}
